package Five;

import java.io.IOException;
import java.net.Socket;

/**
 * description:客户端1
 * @author 长风无言
 */
public class Client1 {

    public static void main(String[] args) {

        Socket socket = null;

        try {
            //连接客户端
            socket = new Socket("127.0.0.1",8888);
            //创建新对象
            ClientThread ct = new ClientThread();
            Thread send = ct.sendFile(socket);
            Thread recevie = ct.recevie();
            //启动线程
            send.start();
            recevie.start();
            send.join();
            recevie.join();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } finally {
            if(null!=socket){
                try {
                    socket.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
